#include <iostream>
#include <string>
#include <tuple>


//std::tuple 可以绑定多个元素
//std::tupel<std::string, int, int>
//std::pair<std::string, int> CreatePersion()
std::tuple<std::string, int> CreatePerson()
{
    return {"caoxiansheng", 34};
}

int main()
{
    auto person = CreatePerson();
    std::string& name  = std::get<0>(person);
    int age = std::get<1>(person);
    std::cout << "name: " << name << " age: " << age << std::endl;

    std::tie(name, age) = CreatePerson();
    std::cout << "name: " << name << " age: " << age << std::endl;
    
    //c++17 结构化绑定
    // 为什么要用只使用一次的类型呢（比如声明一个结构体类型，只使用一次，你会有一个额外的类型）
    // auto[name, age] = CreatePerson();
    // std::cout << "name: " << name << " age: " << age << std::endl;
 } 